package offer.diff;

/**
 * @author DengYuan2
 * @create 2021-03-16 18:59
 */
public class n_10_3 {
    public static void main(String[] args) {

    }

    /**
     * 同上一题
     * @param target
     * @return
     */
    public int jumpFloor(int target) {
        if (target<=2){
            return target;
        }
        int pre1=2;
        int pre2=1;
        int sum=0;
        for (int i = 3; i <=target ; i++) {
            sum=pre1+pre2;
            pre2=pre1;
            pre1=sum;

        }
        return sum;
    }
}
